<extend name="Public/base"/>
<block name="style">
<style type="text/css">	
	.checkmh{
		margin-top:5px;
		height: 16px;
		width: 16px;
	}

	.inputleft{
		float: left;
		border: 0;
	}

	.labelleft{
		float: left;
		padding-top: 4px;
	}
</style>
</block>
<block name="body">
	<div class="main-title">
		<h2>订单统计-按日期统计</h2>
	</div>
	<!-- 按钮工具栏 -->
	<div class="cf">
		<!-- 高级搜索 -->
		<div class="search-form cf">
			<div class="sleft">
				<div class="drop-down">
					<span id="sch-sort-txt" class="sort-txt" data="{$status}"><if condition="get_status_order($status) eq ''">所有<else/>{:get_status_order($status)}</if></span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu" class="nav-list hidden">
						<li><a href="javascript:;" value="">所有</a></li>
						<li><a href="javascript:;" value="1">已确认</a></li>
						<li><a href="javascript:;" value="2">待确认</a></li>
						<li><a href="javascript:;" value="3">已发货</a></li>
						<li><a href="javascript:;" value="0">已作废</a></li>
					</ul>
				</div>
        		<label class="labelleft">日期：</label>
        		<input type="text" id="time-start" name="time-start" class="text input-2x inputleft" value="{$stime}" placeholder="起始时间" />
        		<label class="labelleft"> - </label>
        		<input type="text" id="time-end" name="time-end" class="text input-2x inputleft" value="{$etime}" placeholder="结束时间" />
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('Statistics/orderstatbydate')}"><i class="btn-search"></i></a>
				<a class="btn" href="javascript:;" id="export" url="{:U('Statistics/expOrderFordate')}">Excel导出</a>
			</div>
			<div class="fr">
				<label class="labelleft">总金额：{$zsum} 元</label>
			</div>
		</div>
	</div>
	<!-- 数据列表 -->
    <div class="data-table table-striped">
	    <table class="">
	    	<thead>
	    		<tr>
	    			<th>日期</th>
	    			<th>金额</th>
	    		</tr>
	    	</thead>
	    	<tbody>
	    		<notempty name="_list">
	    		<volist name="_list" id="vo">
	    		<tr>
	    			<td>{$vo.odate}</td>
	    			<td>{$vo.totalje} 元</td>
	    		</tr>
	    		</volist>
	    		<else/>
	    		<td colspan="15" class="text-center">暂时还没有数据！</td>
	    		</notempty>
	    	</tbody>
	    </table>
	    <div class="page">
	    	{$_page}
	    </div>
    </div>
    
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
	<script type="text/javascript">
	$(function(){
		//导出
		$("#export").click(function(){
			var url = $(this).attr('url');
			var status = $("#sch-sort-txt").attr("data");
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
			if(status != ''){
				query = 'status=' + status + "&" + query;
	        }
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});

		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
			var status = $("#sch-sort-txt").attr("data");
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
			if(status != ''){
				query = 'status=' + status + "&" + query;
	        }
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});

		/* 状态搜索子菜单 */
		$(".search-form").find(".drop-down").hover(function(){
			$("#sub-sch-menu").removeClass("hidden");
		},function(){
			$("#sub-sch-menu").addClass("hidden");
		});
		$("#sub-sch-menu li").find("a").each(function(){
			$(this).click(function(){
				var text = $(this).text();
				$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
				$("#sub-sch-menu").addClass("hidden");
			})
		});

		//回车自动提交
	    $('.search-form').find('input').keyup(function(event){
	        if(event.keyCode===13){
	            $("#search").click();
	        }
	    });

	    $('#time-start').datetimepicker({
	        format: 'yyyy-mm-dd',
	        language:"zh-CN",
		    minView:2,
		    autoclose:true
	    });

	    $('#time-end').datetimepicker({
	        format: 'yyyy-mm-dd',
	        language:"zh-CN",
		    minView:2,
		    autoclose:true
	    });
	});

	function refresh(){
	    window.location.reload();//刷新当前页面.
	    
	    //或者下方刷新方法
	    //parent.location.reload()刷新父亲对象（用于框架）--需在iframe框架内使用
	    // opener.location.reload()刷新父窗口对象（用于单开窗口
	  //top.location.reload()刷新最顶端对象（用于多开窗口）
	}
    //导航高亮
    highlight_subnav('{:U('Statistics/orderstatbydate')}');
	</script>
</block>